<?
$answers = $this->answers;
?>

<div class="content-box">

    <div class="content-box-header">
        <h3>Answers</h3>
        <ul class="content-box-tabs">
            <li><a href="#tab1" class="default-tab">Table</a></li>

        </ul>
        <div class="clear"></div>
    </div>
    
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
            <table>
                <thead>
                <tr>
                    <th>Name</th>
                    <th>Last Name</th>
                    <th>Email</th>
                    <th>Answer</th>
                    <th>Date</th>
                    <th>Is correct</th>
                    <th>Is winner</th>
                    <th>Time taken(seconds)</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                <? foreach ($answers as $answer): ?>
                <tr>
                    <td><?= $answer['user']['name'] ?></td>
                    <td><?= $answer['user']['lastName'] ?></td>
                    <td><?= $answer['user']['email'] ?></td>
                    <td><?= $answer['answer'] ?></td>
                    <td><?= $answer['time']->format('Y-m-d H:i:s') ?></td>
                    <td>
                        <?= $correct = $answer['isCorrect'] ? "yes" : "no" ?>
                    </td>
                    <td>
                        <?= $correct = $answer['winner'] ? "yes" : "no" ?>
                    </td>

                    <td>
                        <?= $answer['timeTaken'] ?>
                    </td>

                    <td>
                        <? if ($answer['winner']): ?>
                        <a href="/quests/winner/type/remove/id/<?= $answer['id'] ?>">
                            <img src="/admin_/images/icons/cross_circle.png" alt="Remove the winner" />
                        </a>
                        <? else: ?>
                        <a href="/quests/winner/type/set/id/<?= $answer['id'] ?>">
                            <img src="/admin_/images/icons/tick_circle.png" alt="Set the winner" />
                        </a>
                        <? endif; ?>
                    </td>
                </tr>
                    <? endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>